@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
  }

  * {
    box-sizing: border-box;
  }

  /* 移动端滚动优化 */
  .scroll-smooth {
    -webkit-overflow-scrolling: touch;
  }

  /* 防止iOS Safari底部工具栏遮挡 */
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* 防止刘海屏遮挡 */
  .safe-area-top {
    padding-top: env(safe-area-inset-top);
  }
}

@layer utilities {
  /* 移动端专用工具类 */
  .touch-none {
    touch-action: none;
  }

  .touch-pan-x {
    touch-action: pan-x;
  }

  .touch-pan-y {
    touch-action: pan-y;
  }

  /* 1px边框解决方案 */
  .border-hairline {
    position: relative;
  }

  .border-hairline::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    border: 1px solid #e5e7eb;
    transform: scale(0.5);
    transform-origin: 0 0;
    pointer-events: none;
  }
}
